﻿// Date: 06.10.11

// Revision 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BEPUphysicsDrawer.Models;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace NOVA.Utilities
{
    /// <summary>
    /// Renders the collision meshes of the scene objects by 
    /// using a similar implementation of the BruteModelDrawer
    /// of the BEPUphysics debug drawer.
    /// </summary>
    public class CollisionMeshRenderer : InstancedModelDrawer
    {
        private Microsoft.Xna.Framework.Color color;
        public Color Color 
        {
            get { return this.color; }
            set { this.color = value; }
        }
        
        public CollisionMeshRenderer(Game game)
            : base(game)
        {
            
        }

        /// <summary>
        /// Sets the collision mesh color by changing all internal
        /// textures of the ModelDrawer.
        /// </summary>
        public void SetColor(Color newColor)
        {/*
            for (int i = 0; i < textures.Length; i++)
            {
                textures[i].SetData<Color>(new Color[]{newColor});
            }*/

            this.colors.SetData<Color>(new Color[] { newColor, newColor, newColor, newColor, newColor, newColor, newColor, newColor });
            
            Color = newColor;
        }
    }
}
